package com.manager.web;

import com.manager.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @Autowired

    @RequestMapping(value = "/index", method = RequestMethod.GET)
    public String index() {
        return "index";
    }

    @RequestMapping(value = "/verify", method = {RequestMethod.GET, RequestMethod.POST}
            /*,produces = "application/json;charset=utf8"*/)
    @ResponseBody
    public Object verify(@RequestParam("userid") String userid, @RequestParam("password") String password,@RequestParam("identity") int identity,@RequestParam("online") boolean online) {
        return userService.verify(userid, password,identity,online);
    }
    /**
     * 需要一个跳转，其中管理员跳到管理界面。
     * @param userid
     * @param identity
     * @param model
     * @return
     */
    @RequestMapping(value = "/personal",method = RequestMethod.GET)
    public String personal(@RequestParam("userid") String userid,@RequestParam("identity") String identity,Model model){
        model.addAttribute("userid",userid);
        return "personal";
    }
}